<?php

class Eleven_Resource_Catepic extends CMS_Model_Resource_Db_Table_Abstract
{
	protected $_name = 'catepic';
	protected $_primary = 'id';
	protected $_rowClass = 'Eleven_Resource_Catepic_Item';
	
	protected $_dependentTables = array('Eleven_Resource_Picture');
	    
    public function getCatePics($order='id DESC')
	{
	    $select = $this->select();
	    $select->order($order);
	    
	    return $this->fetchAll($select);
	}
	
	public function getCatePicturesById($id)
	{
	    $id = (int) $id;
	    return $this->find ( $id )->current ();
	}
	
	public function deleteCatepicById($id)
	{
		$cate = $this->find ( $id )->current ();
	    return $cate->delete();
	}
	
}

?>